<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>{:COMPANY}</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="description" content="">
        <meta name="keywords" content="coco bootstrap template, coco admin, bootstrap,admin template, bootstrap admin,">
        <meta name="author" content="Huban Creative">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

        <!-- Base Css Files -->
        <link href="{:__BOOTSTRAP__}css/bootstrap.min.css" rel="stylesheet" />
        <link href="{:__CSS__}font-awesome/css/font-awesome.min.css" rel="stylesheet" />
        <link href="{:__CSS__}fontello/css/fontello.css" rel="stylesheet" />

        <!-- Extra CSS Libraries Start -->
        <link href="{:__CSS__}style.css" rel="stylesheet" type="text/css" />
        <link href="{:__CSS__}jquery.datetimepicker.css" rel="stylesheet" type="text/css" />

        <link rel="stylesheet" href="{:__CSS__}map_toolbar.css"/>
        <!-- Extra CSS Libraries End -->
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->

        <link rel="shortcut icon" href="{:__IMG__}Besiness/favicon.ico">
        <script type="text/javascript" src="{:__LIBS__}jquery/jquery-1.11.1.min.js"></script>
        <!--validform-->
        <link rel="stylesheet" type="text/css" href="{:__LIBS__}validform/css/style.css"  />
        <script type="text/javascript" src="{:__LIBS__}validform/js/Validform_v5.3.2.js"></script>
    </head>


    <!-- Start content-->
    <div class="content">
        <div class="widget">
            <div class="widget-header transparent">
                <h2><strong>医生管理</strong></h2>
            </div>
            <div class="widget-content padding">
                <form class="form-horizontal demoform" role="form" method="post" action="" enctype="multipart/form-data">
                    <input type="hidden" name='did' value='{$data.did}' />
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span>*</span>姓名：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control empty" id="app-name" maxlength="15"  name="name" value="{$data.name}" placeholder="请输入医生姓名">
                            <span class="Validform_checktip"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span>*</span>科室：</label>
                        <div class="col-sm-10">
                            <select name="tid" class="form-control empty">
                                <option value="0">--请选择科室--</option>
                                <foreach name="section" item="v">
                                    <if condition="$v['id'] eq $data['tid'] ">
                                        <option value="{$v.id}" selected='selected'>{$v.name}</option>
                                        <else />    
                                        <option value="{$v.id}">{$v.name}</option>
                                    </if>
                                </foreach>
                            </select>
                            <span class="Validform_checktip"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <if condition="$data['header'] neq null">
                            <label class="col-sm-2 control-label"><span>*</span>医生头像：</label>
                            <div class="col-sm-6">
                                <div>
                                    <input type="hidden" name='header' value='{$data.header}'/>
                                    <img src="{$data.header}" width='100px'>
                                </div>
                            </div>                 
                            <else />    
                            <label class="col-sm-2 control-label"><span>*</span>医生头像：</label>
                            <div class="col-sm-10">     
                                <input type="file" name="header" class="form-control" style="border:none;">

                            </div>
                        </if>
                    </div>
                    <if condition="$data['header'] neq null">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><span>*</span>修改医生头像：</label>
                            <div class="col-sm-6">        
                                <div>

                                    <input type="file" name="new_header" class="form-control">
                                </div>
                            </div>       
                        </div>
                    </if>     
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span>*</span>职称：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control empty" id="app-name" maxlength="15"  name="title" value="{$data.title}" placeholder="请输入职称">
                            <span class="Validform_checktip"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span>*</span>联系电话：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control empty iphone" id="app-name" maxlength="15"  name="phone" value="{$data.phone}" placeholder="请输入联系电话">
                            <span class="Validform_checktip"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span>*</span>简介：</label>
                        <div class="col-sm-6">
                            <textarea class="form-control empty" name="intro">{$data.intro}</textarea>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span>*</span>地址：</label>
                        <div class="col-sm-10" id="city_2">
                            <input type="text" name="address" id="address" class="form-control empty" maxlength="30" value="{$data.address}" placeholder="请输入详细地址">
                            <span class="Validform_checktip"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span>*</span>每天接诊量：</label>
                        <div class="col-sm-10">
                            <input type="text" name="reception_sun" class="form-control empty" maxlength="30" value="{$data.reception_sun}" placeholder="请输入每天接诊量">
                            <span class="Validform_checktip"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span>*</span>工作时间：</label>
                        <div class="col-sm-6">
                            <input class="col-time" name="working" value="{$data.working}" id="datetimepicker" type="text" />
                            至&nbsp;&nbsp;<input class="col-time" name="getoff" value="{$data.getoff}" id="datetimepicker1" type="text" />
                        </div>
                    </div>

                    <div class="form-group">

                        <label class="col-sm-2 control-label">地图定位：</label>
                        <input type="hidden" class="form-control" id="map_lat" name="lat" value="{$data.lat}" />
                        <input type="hidden" class="form-control" id="map_lng" name="lng" value="{$data.lng}" /> 

                        <div  class="col-sm-10" id="container" >
                            <div id="myPageTop">
                                <table>
                                    <tr>
                                        <td>
                                            <label>按关键字搜索：</label>
                                        </td>
                                        <td class="column2">
                                            <label>左击获取经纬度：</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <input type="text" placeholder="请输入关键字进行搜索" id="tipinput">
                                        </td>
                                        <td class="column2">
                                            <input type="text" readonly="true" id="lnglat">
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                    <hr>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button id="inbut" type="submit" class="btn btn-success">保存并发送</button>
                            <button type="button" onclick="window.history.back(-1);" class="btn btn-default">返回</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <!-- Footer Start -->
        <div class="footer">Copyright &copy; {:COMPANY}</div>
        <!-- Footer End -->
    </div>
    <div class="set-box">
        <!--checkbox css-->
        <link href="{:__CSS__}style.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="{:__CSS__}_all.css">

        <script type ="text/javascript" src="{:__JS__}common.js"></script>

    </div>

    <!-- End content-->
    <!--data 时间-->
    <script type="text/javascript" src="{:__JS__}jquery.datetimepicker.full.js"></script>

    <script type="text/javascript" src="{:__JS__}common.js"></script>         
    <script type="text/javascript" src="{:__JS__}admin_common.js"></script>  
    <!-- 高德地图 -->
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=7d2964c7485090d75aed48f279796a49&plugin=AMap.Autocomplete"></script>
    <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
    <script>
                                $(".set-box .my_page span").eq(0).click();
                                //高德地图start
                                var map = new AMap.Map('container');
                                map.setZoom(20); //设置缩放比例
                                map.setCenter([{$data.lng},{$data.lat}]); //初始中心点
                                //配置 - 中心点                     
                                var content = document.createElement('div');
                                content.innerHTML = '医生';
                                content.className = 'map_tag';
                                //初始点标记
                                var marker = new AMap.Marker({
                                    title: '{$data.name}',
                                    position: [{$data.lng},{$data.lat}],
                                    map: map
                                });
                                //为地图注册click事件获取鼠标点击出的经纬度坐标
                                var clickEventListener = map.on('click', function (e) {
                                    marker.setPosition([e.lnglat.getLng(), e.lnglat.getLat()]); //更新点标记位置
                                    document.getElementById("map_lat").value = e.lnglat.getLat();
                                    document.getElementById("map_lng").value = e.lnglat.getLng();
                                    document.getElementById("lnglat").value = e.lnglat.getLng() + ',' + e.lnglat.getLat();
                                    var lat = e.lnglat.getLat();
                                    var lng = e.lnglat.getLng();
                                    get_address(lat, lng);
                                });
                                var auto = new AMap.Autocomplete({
                                    input: "tipinput"
                                });
                                AMap.event.addListener(auto, "select", select); //注册监听，当选中某条记录时会触发
                                function select(e) {
                                    if (e.poi && e.poi.location) {
                                        map.setZoom(15);
                                        map.setCenter(e.poi.location);
                                    }
                                }
                                //end 高德地图
                                $(function () {
                                    $('#datetimepicker,#datetimepicker1').datetimepicker({
                                        datepicker: false,
                                        format: 'H:i',
                                        step: 5,
                                    });
                                    $('#datetimepicker2').datetimepicker({
                                        timepicker: false,
                                        format: 'Y-m-d',
                                    });
                                    $(".tags_submit").click(function () {
                                        var obj = $("#add_tags").val();
                                        if (obj != "" && obj != undefined) {
                                            $(".tags_more").append('<a class="btn btn-green-1 but-top btn-right">' + obj + '</a>');
                                            $("#tags").val($("#tags").val() + obj + ",");
                                            $("#add_tags").val("");
                                        }
                                    });
                                    $(".tags_more").on("mouseenter", "a", function () {
                                        $(this).append('<i class="icon icon-cancel-3"></i>');
                                    });
                                    $(".tags_more").on("mouseleave", "a", function () {
                                        $(this).find("i").remove();
                                    });
                                    $(".tags_more").on("click", "a i", function () {
                                        $(this).parents("a").remove();
                                        $("#tags").val("");
                                        $(".tags_more a").each(function () {
                                            var obj = $(this).html();
                                            $("#tags").val($("#tags").val() + obj + ",")
                                        });
                                    });
                                    //单位
                                    $("#unit").bind("click", function () {
                                        var obj = $(this);
                                        if (obj.hasClass("it_unit")) {
                                            obj.after('<input class="form-control col-sm-2 btn-left" type="text" maxlength="3" value="" />');
                                            obj.prev(".it_ar").hide()
                                            obj.removeClass("it_unit").addClass("it_ture").html("确认更改");
                                        } else {
                                            var name = obj.next().val();
                                            if (name == "") {
                                                obj.prev(".it_ar").show();
                                                obj.next().remove();
                                                obj.removeClass("it_ture").addClass("it_unit").html("更改单位");
                                            } else {
                                                obj.removeClass("it_ture").addClass("it_unit").html("更改单位");
                                                obj.prev(".it_ar").html(name).show();
                                                obj.next().remove();
                                            }
                                        }
                                    });
                                    $("#app-name").bind("blur", function () {
                                        var obj = $(this);
                                        if (!(obj.val() == "")) {
                                            var name = obj.val().split("", 1);
                                            $(".app_size").val(name);
                                            $(".app_img").html(name);
                                        }
                                    });
                                });
                                function get_address(lat, lng) {
                                    $.ajax({
                                        type: "post",
                                        url: 'http://restapi.amap.com/v3/geocode/regeo?output=json&location=' + lng + ',' + lat + '&key=22f9022b217b7d764f5befb4aa74456f&radius=1000&extensions=all&callback=renderOption',
                                        success: function (re) {
                                            //alert(re.regeocode.formatted_address)
                                            $("#address").val(re.regeocode.formatted_address);
                                            console.log(re);
                                        }
                                    })
                                }
    </script>


</html>
